package com.zp.builder;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhpeng
 * @discription
 * @created 2021/9/3 15:00
 */
public class Home {
    private List<Item> items = new ArrayList<Item>();
    public void addItem(Item item){
        items.add(item);
    }

    public int getCost(){
        int sumCost = 0;
        for(Item item:items){
            sumCost+=item.price();
        }
        return sumCost;
    }
    public void showAllItems(){
        System.out.println("start show all items:");
        for(Item item:items){
            System.out.print("name:"+item.name());
        }
        System.out.println();
    }
}
